ident = letter {letter | digit}
integer = digit {digit}

factor = ident | integer | "(" expression ")"

term = factor {("*" | "/" | "&" | "^" | "<<" | ">>" "ROT") factor}

expression = ["+"|"-"|"~"] term {("+"| "-" | "|") term}

condition = expression ("=" | "#" | "<" | ">=" | "<=" | ">") expression

statement = [
    ident ":=" expression
  | "CALL" ident
  | "IF" condition "THEN" StatementSequence ["ELSE" StatementSequence] "END" 
  | "WHILE" condition "DO" StatementSequence "END"]

StatementSequence = Statement {";" Statement}

declarations = ["MEM" ident "=" number {"," ident "=" number} ";"] 
               ["CONST" ident "=" number {"," ident "=" number} ";"]
               ["VAR" ident {"," ident} ";"]

module = declarations {"PROCEDURE" procedure_decl} "BEGIN" StatementSequence "END" "."

procedure = ident ";" declarations "BEGIN" StatementSequence "END" ";"
